package bb.lanxing.lib.devices.bryton.bbcp;

public class BbcpDataStartFragment extends BbcpData {
    public BbcpDataStartFragment(short s, byte b, byte b2, byte b3) {
        super((byte) 0);
        this.mSeqNo = (short) 0;
        this.payload = new byte[5];
        BbcpData.shortToBytes(s, this.payload, 0);
        this.payload[2] = b;
        this.payload[3] = b2;
        this.payload[4] = (byte) (b3 << 2);
    }

    public BbcpDataStartFragment(byte[] bArr) {
        super((byte) 0);
        this.mSeqNo = BbcpData.toShort(bArr, 0);
        int length = bArr.length - 2;
        this.payload = new byte[length];
        System.arraycopy(bArr, 2, this.payload, 0, length);
    }

    public short getFragmentCount() {
        return toShort(this.payload, 0);
    }

    public byte getLastFragmentSize() {
        return this.payload[2];
    }

    public byte getCmdId() {
        return this.payload[3];
    }

    public byte getCmdSeqNo() {
        return (byte) ((this.payload[4] & 28) >> 2);
    }

    public byte[] getExtraData() {
        if (this.payload.length > 5) {
            int length = this.payload.length - 5;
            byte[] bArr = new byte[length];
            System.arraycopy(this.payload, 5, bArr, 0, length);
            return bArr;
        }
        return null;
    }
}
